####################################
# Check continuity gender
####################################

rm(list=ls())

library(Hmisc)
library(ggplot2)
library(stargazer)
library(foreign)
library(rdrobust)
library(rdd)
library(readstata13)

################
# Prepare data 
################

# read data
load("~/Dropbox/Gender Chile/08_replication/gender_chile_2020aug28.RData")  
names(d)

# variables
d$distance_log = log(d$distance+1)

# bandwidth
h_bw = rdbwselect(d$permanent_temporary,d$margin,cluster=d$cluster)$bws[1]

#########################
# Outcomes 
#########################

summary(rdrobust(d$pinera06_2_p,d$margin,cluster = d$cluster,all=TRUE))
summary(rdrobust(d$bachelet06_2_p,d$margin,cluster = d$cluster,all=TRUE))
summary(rdrobust(d$idh98,d$margin,cluster = d$cluster,all=TRUE),h=h_bw)
summary(rdrobust(d$rankingsalud98,d$margin,cluster = d$cluster,all=TRUE))
summary(rdrobust(d$rankingeducacion98,d$margin,cluster = d$cluster,all=TRUE))
summary(rdrobust(d$rankingingreso98,d$margin,cluster = d$cluster,all=TRUE))
summary(rdrobust(d$countysize,d$margin,cluster = d$cluster,all=TRUE))
summary(rdrobust(d$distance,d$margin,cluster = d$cluster,all=TRUE))

